package demo05extends;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:咭咭熊
 * Date:2021 - 09 - 23
 * Time:18:50
 */
class X{
    Y y = new Y();
    public X(){
        System.out.println("X");
    }
}
class Y{
    public Y(){
        System.out.println("Y");
    }
}
public class Z extends X{
    Y y = new Y();//1.实例的
    public Z(){//2.构造的
        System.out.println("Z");
    }

    //执行顺序：静态的——实例的——构造方法
    public static void main(String[] args) {
        new Z();// Y X Y Z
    }
}
